﻿<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>我的课时</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="css/order_css1.css" rel="stylesheet" /></head>
  <script src="../../backstage/lib/jquery/1.9.1/jquery.min.js"></script>
  
  <body onload="getMainInfoManager()">
    <section class="aui-flexView">

      <section class="aui-scrollView">
        <div class="aui-order-title" id ="order-list">
         <!-- <h2>已完成订单</h2>-->
          
        </div>
      </section>
    </section>
    <script>
        function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg); //search,查询？后面的参数，并匹配正则
    if (r != null) return unescape(r[2]);
    return null;
    }

        function getMainInfoManager() {

            getWechatInfo();
        }

        // 获取微信信息
        function getWechatInfo() {
            var code = GetQueryString('code');

            var args = $.param({
                "code": code
            })
            $.ajax({
                url: '../../ChireInter/Wechat/wechat_auth.ashx',
                data: args,
                type: 'post',
                dataType: 'json',
                success: function (res) {
                    if (res.errCode == 200) {
                        getOrderListManager();
                    } else {

                    }
                },
                error: function (err) {

                }
            })

        }

        // 获取微信信息
        function getOrderListManager() {
            var code = GetQueryString('code');

            var args = $.param({
                "code": code
            })
        
            $.ajax({
                url: '../../ChireInter/Order/Order_Single_List.ashx',
                data: args,
                type: 'post',
                dataType: 'json',
                success: function(res) {
                    if (res.errCode == 200) {
                        var html = "";

                        if (res.data.willStartList != null) {
                            html += " <h2>即将开课</h2>";
                        }

                        for (var i in res.data.willStartList) {
                            html += "<div class=\"aui-order-box\">";
                            html += "<a href=\"javascript:void(0);\" class=\"aui-well-item\">";
                            html += "<div class=\"aui-well-item-bd\">";
                            html += " <h3>" + res.data.willStartList[i].name + "</h3></div>"
                            html += "<span class=\"aui-well-item-fr\">" + res.data.willStartList[i].status + "</span></a>";
                            html += "<p class=\"aui-order-fl aui-order-time\">" + res.data.willStartList[i].detail + "</p>";
                            html += "<p class=\"aui-order-fl aui-order-address\">" + res.data.willStartList[i].order_type + "</p>";
                            html += "<p class=\"aui-order-fl aui-order-door\">" + "计算课时" + res.data.willStartList[i].order_time + "</p></div>";
                        }

                        if (res.data.endList != null) {
                            html += " <h2>已结算课时</h2>";
                        }

                        for (var i in res.data.endList) {
                            html += "<div class=\"aui-order-box\">";
                            html += "<a href=\"javascript:void(0);\" class=\"aui-well-item\">";
                            html += "<div class=\"aui-well-item-bd\">";
                            html += " <h3>" + res.data.endList[i].name + "</h3></div>"
                            html += "<span class=\"aui-well-item-fr\">" + res.data.endList[i].status + "</span></a>";
                            html += "<p class=\"aui-order-fl aui-order-time\">" + res.data.endList[i].detail + "</p>";
                            html += "<p class=\"aui-order-fl aui-order-address\">" + res.data.endList[i].order_type + "</p>";
                            html += "<p class=\"aui-order-fl aui-order-door\">" + "计算课时" + res.data.endList[i].order_time + "</p></div>";
                        }

                        var oContent = $('#order-list')

                        oContent.prepend(html);
                    } else {

                    }
                },
                error: function(err) {

                }
            })

        }

    </script>
  </body>

</html>